package com.news.bean;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
import org.apache.commons.fileupload.FileItem;

/*
 * 添加信息-声明信息内容
 */
public class News {
	//信息id
	private int id;
	//标题
	private String title;
	//图片
	private String pic;
    private byte[] picFile;
	//新闻类别，所属种类
	private int sort;
	//作者，发布信息的
	private String writer;
	//发布时间
	private String dates;
	//是否显示
	private String shows;
	//信息内容
	private String message;
	//点击次数
	private Integer hits;
	

	public String getNewsTypeId() {
		// TODO Auto-generated method stub
		return null;
	}

    public void init(LinkedHashMap<String, Object> map) {
        Set keys = map.keySet();
        Iterator keyIter = keys.iterator();
        while (keyIter.hasNext()) {
            String key = keyIter.next().toString().trim();
            if (key.equalsIgnoreCase("id")) {
                this.id=Integer.valueOf(map.get(key)==null?"0":map.get(key).toString().trim());
                continue;
            }
            if (key.equalsIgnoreCase("title")) {
                this.title=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("picfile")) {
                this.picFile=(byte[])map.get(key);
                continue;
            }
            if (key.equalsIgnoreCase("pic")) {
                this.pic=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("sort")) {
                this.sort=Integer.valueOf(map.get(key)==null?"0":map.get(key).toString().trim());
                continue;
            }
            if (key.equalsIgnoreCase("writer")) {
                this.writer=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("dates")) {
                this.dates=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("shows")) {
                this.shows=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("message")) {
                this.message=map.get(key).toString();
                continue;
            }
            if (key.equalsIgnoreCase("hits")) {
                this.hits=Integer.valueOf(map.get(key)==null?"0":map.get(key).toString().trim());
                continue;
            }
        }
    }

	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
	}


	public String getPic() {
		return pic;
	}

    public byte[] getPicFile() {
        return this.picFile;
    }

	public void setPic(String pic) {
		this.pic = pic;
	}

    public void setPicFile(byte[] pic) {
        this.picFile = pic;
    }

	public int getSort() {
		return sort;
	}


	public void setSort(int sort) {
		this.sort = sort;
	}


	public String getWriter() {
		return writer;
	}


	public void setWriter(String writer) {
		this.writer = writer;
	}


	public String getDates() {
		return dates;
	}


	public void setDates(String dates) {
		this.dates = dates;
	}


	public String getShows() {
		return shows;
	}


	public void setShows(String shows) {
		this.shows = shows;
	}


	public String getMessage() {
		return message;
	}


	public void setMessage(String message) {
		this.message = message;
	}


	public Integer getHits() {
		return hits;
	}


	public void setHits(Integer hits) {
		this.hits = hits;
	}
}
